/**
 * VIP会员相关API接口
 * @author 王勇程 <laughskydragon@qq.com>
 */

import request from '@/utils/request'

// 获取VIP套餐列表
export function getVipPackages() {
  return request({
    url: '/vip/getVipPackages',
    method: 'post'
  })
}

// 获取用户VIP信息
export function getVipInfo() {
  return request({
    url: '/vip/getUserVipInfo',
    method: 'post'
  })
}

// 创建VIP订单
export function createVipOrder(data) {
  return request({
    url: '/vip/createVipOrder',
    method: 'post',
    data
  })
}

// 支付成功回调
export function vipPaymentCallback(data) {
  return request({
    url: '/vip/paymentSuccess',
    method: 'post',
    data
  })
}

// 获取最近开通VIP用户
export function getRecentVipUsers() {
  return request({
    url: '/vip/getRecentVipUsers',
    method: 'post'
  })
}

// 检查VIP状态
export function checkVipStatus() {
  return request({
    url: '/vip/checkUserVip',
    method: 'post'
  })
}

// 获取VIP历史记录
export function getVipHistory() {
  return request({
    url: '/vip/getUserVipHistory',
    method: 'post'
  })
}

// 获取最近购买VIP的用户列表
export function getVipUserList(data) {
  return request({
    url: '/vip/getRecentVipUsers',
    method: 'post',
    data
  })
}

// 支付VIP（创建订单）
export function payVip(data) {
  return request({
    url: '/vip/createOrder',
    method: 'post',
    data
  })
}

// 请求支付
export function requestPayment(data) {
  return request({
    url: '/vip/requestPayment',
    method: 'post',
    data
  })
}

export default {
  getVipPackages,
  getVipInfo,
  createVipOrder,
  vipPaymentCallback,
  getRecentVipUsers,
  checkVipStatus,
  getVipHistory,
  getVipUserList,
  payVip,
  requestPayment
}